{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li ><a href="{php echo web_url('dashboard/adv/index')}">幻灯片</a></li>
	<li class="active"><a href="{php echo web_url('dashboard/adv/edit')}">{if empty($adv['id'])}添加幻灯片{else}编辑幻灯片{/if}</a></li>
</ul>
<div class="app-content">
	<div class="app-form">
		<form action="" method="post" class="form-horizontal form form-validate" >
			<input type="hidden" name="id" value="{$adv['id']}" />
			<input type="hidden" name="cateid" value="{$cateid}" />
			<div class="panel panel-default">
				<div class="panel-heading">幻灯片设置</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">排序</label>
					<div class="col-sm-9">
						<input type="text" name="adv[displayorder]" placeholder="默认排序为0" class="form-control" value="{$adv['displayorder']}" >
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">幻灯片标题<span class="must-fill">*</span></label>
					<div class="col-sm-9">
						<input type="text" name="adv[advname]" required class="form-control" value="{$adv['advname']}" >
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">幻灯片图片<span class="must-fill">*</span></label>
					<div class="col-sm-9">
						{php echo attachment_select('adv[thumb]',$adv['thumb'])}
						<span class="help-block">建议图片大小为640*300,实际显示比例根据后台设置为准。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">幻灯片连接</label>
					<div class="col-sm-9">
						<div class="input-group" style="margin: 0;">
							<input type="text" name="adv[link]" class="form-control" value="{$adv['link']}" readonly="readonly" name="link" placeholder="" id="advlink">
							<span data-input="#advlink" data-toggle="selectUrl" class="input-group-addon btn btn-default">选择链接</span>
							<span class="input-group-addon btn btn-default clearinput">X</span>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">显示位置</label>
					<div class="col-sm-9">
						<select name="adv[type]" class="form-control">
							<option value="0" {if $adv['type'] == 0 || empty($adv['type'])} selected="selected" {/if} >首页</option>
							<option value="1" {if $adv['type'] == 1} selected="selected" {/if} >好店</option>
							<option value="2" {if $adv['type'] == 2} selected="selected" {/if} >超级券</option>
							<!--<option value="3" {if $adv['type'] == 3} selected="selected" {/if} >商家折扣</option>-->
							<option value="4" {if $adv['type'] == 4} selected="selected" {/if} >抢购</option>
							<!--<option value="5" {if $adv['type'] == 5} selected="selected" {/if} >一卡通首页</option>-->
							{if p('groupon')}
							<option value="7" {if $adv['type'] == 7} selected="selected" {/if} >团购</option>
							{/if}
							<option value="8" {if $adv['type'] == 8} selected="selected" {/if} >拼团</option>
							{if p('bargain')}
							<option value="9" {if $adv['type'] == 9} selected="selected" {/if} >砍价</option>
							{/if}
							{if p('headline')}
							<option value="10" {if $adv['type'] == 10} selected="selected" {/if} >头条</option>
							{/if}
							{if p('citycard')}
								<option value="11" {if $adv['type'] == 11} selected="selected" {/if} >名片</option>
							{/if}
							{if p('citydelivery')}
							<option value="12" {if $adv['type'] == 12} selected="selected" {/if} >同城配送</option>
							{/if}
							{if p('yellowpage')}
							<option value="13" {if $adv['type'] == 13} selected="selected" {/if} >黄页114</option>
							{/if}
							{if p('activity')}
							<option value="14" {if $adv['type'] == 14} selected="selected" {/if} >活动首页</option>
							{/if}
							{if p('recruit')}
								<option value="15" {if $adv['type'] == 15} selected="selected" {/if} >招聘首页</option>
							{/if}
							{if p('dating')}
								<option value="16" {if $adv['type'] == 16} selected="selected" {/if} >相亲交友</option>
							{/if}
							{if p('vehicle')}
								<option value="17" {if $adv['type'] == 17} selected="selected" {/if} >顺风车</option>
							{/if}
							{if p('housekeep')}
							<option value="18" {if $adv['type'] == 18} selected="selected" {/if} >家政服务</option>
							{/if}
							{if uniacid_p('mobilerecharge')}
							<option value="19" {if $adv['type'] == 19} selected="selected" {/if} >话费充值</option>
							{/if}
							{if file_exists(PATH_MODULE . 'L304.log') && !is_agent()}
							<option value="120" {if $adv['type'] == 120} selected="selected" {/if} >直播列表</option>
							{/if}
							{if p('house')}
							<option value="20" {if $adv['type'] == 20} selected="selected" {/if} >房产</option>
							{/if}
							<option value="21" {if $adv['type'] == 21} selected="selected" {/if} >支付广告</option>

							{if agent_p('hotel')}
							<option value="22" {if $adv['type'] == 22} selected="selected" {/if} >酒店</option>
							{/if}

						</select>
					</div>
				</div>
				{if !empty($cateid) && p('groupon')}
					<div class="form-group">
						<div class="col-sm-2 control-label must">所属分类名称</div>
						<div class="col-sm-9">
							<input class="form-control" value="{$catename}" readonly="true" />
						</div>
					</div>
				{/if}
				<div class="form-group">
					<label class="col-sm-2 control-label">是否显示</label>
					<div class="col-sm-9">
						<label class="radio-inline">
							<input type="radio" name='enabled' value='1' {if $adv['enabled']==1}checked{/if} title="">是
						</label>
						<label class="radio-inline">
							<input type="radio" name='enabled' value='0' {if $adv['enabled']==0}checked{/if} title="">否
						</label>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-9">
					<input type="submit" name="submit" lay-submit value="提交" class="btn btn-primary min-width" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	/**
	 * 点击删除图片或者链接
	 */
	$(".form").on('click','.clearinput',function () {
		$(this).prev().prev().val('');
	});
</script>
{php include wl_template('common/footer');}